import storage from '@/utils/storage'
import { APP_SETTING } from '@/store/mutation-types'

const app = {
  state: {
    // 当前终端平台
    platform: '',
	// 设置
	setting: {}
  },

  mutations: {
    SET_PLATFORM: (state, value) => {
      state.platform = value
    },
	SET_SETTING: (state, value) => {
	  state.setting = value
	}
  },

  actions: {
  
    // 记录自定义主题
    SetAppSetting({ commit }, value) {
      return new Promise((resolve, reject) => {
        storage.set(APP_SETTING, value)
        commit('SET_SETTING', value)
        resolve()
      })
    }
  
  }
}

export default app